class Solution2 {
    public void moveZeroes(int[] nums) {
        int len = nums.length;

        int start = 0; //移动过后，0 的开始位置
        for (int i = 0; i < len; i++) {
            if (nums[i] != 0) {
                nums[start++] = nums[i];
            }
        }

        for (int i = start; i < len; i++) {
            nums[i] = 0;
        }
    }
}